package com.yuchen.ishop.service.admin.sys.impl;

import com.yuchen.core.jdbc.BaseDao;
import com.yuchen.ishop.entity.Role;
import com.yuchen.ishop.service.admin.sys.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RoleServiceImpl implements RoleService {
	
	@Autowired
    private BaseDao dao;

	@Override
	public Role insert(Role t) {
		return dao.insert(t);
	}

	@Override
	public int update(Role t,boolean isIgnoreNull) {
		if(isIgnoreNull) return dao.updateIgnoreNull(t);
		return dao.update(t);
	}

	@Override
	public Role getById(Long id) {
		return dao.fetch(Role.class, id);
	}

	@Override
	public int delete(Long id) {
		return dao.delete(Role.class,id);
	}

	@Override
	public List find() {
		return dao.query(Role.class,null);
	}
}
